package com.awb.rabbitmqdemo.workqueues;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WorkConsumer {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    @RabbitHandler
    @RabbitListener(queuesToDeclare = @Queue("work_queue"))
    public  void  process1(String message){
        System.out.println("work模式1接收消息："+message);
    }

    @RabbitHandler
    @RabbitListener(queuesToDeclare = @Queue("work_queue"))
    public  void  process2(String message){
        System.out.println("work模式2接收消息："+message);
    }
}
